/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package FrameWork;

import java.io.*;

/**
 *
 * @author DANTRUONG
 */
public class LoadLine{
    
    InputStream is;
    
    public LoadLine(String filename) {
       is = this.getClass().getResourceAsStream(filename);
    }

    public String readLine()
    {
        String line = "";
        try {
            int ch = is.read();
            if (ch==-1) {
                is.close();
                return null;
            }
            else 
                while (ch != -1 && ch != 13) {
                    if (ch!=10) line += (char)ch;                   
                    ch = is.read();
                }
                return line;
        }
        catch (Exception e) {
            System.out.println("Error when reading file" +e.getMessage());
        }
        return null;
    }  
}
